package org.testfire.translator.watij.assertions;

import org.testfire.model.assertions.AssertSame;
import org.testfire.model.TestsetType;
import org.testfire.translator.TestFireTranslator;
import org.testfire.translator.TranslatorFactory;

/**
 * Created by IntelliJ IDEA.
 * User: granum
 * Date: Sep 2, 2007
 * Time: 5:49:04 PM
 *
 */
public class AssertSameTranslator<T> implements TestFireTranslator<AssertSame>
{

    public Object translate( TestsetType testset, AssertSame type )
    {
        StringBuilder buf = new StringBuilder();
        String assertName = type.isAsNotSame() ? "assertNotSame" : "assertSame";
        buf.append( String.format( "%4$s( \"%1$s\", \"%2$s\", %3$s )", type.getMessage(), type.getExpected(),
            TranslatorFactory.translate( testset, type.getFinder() ), assertName ) );
        return buf.toString();
    }
}